<?php

        $JFV=Yii::app()->jformvalidate;

            

        $JFV->setOptions(array(

		'errorElement'=> 'span',
		'errorClass' => 'invalid',

        ));


?>
<div class="yiiForm">
<?php echo $JFV->form(); ?>

<?php echo Html::errorSummary($model); ?>

<div class="simple">
<?php echo Html::activeLabel($model,'title'); ?>
<?php echo $JFV->activeTextField($model,'title'); ?>
</div>
<div class="simple">
<?php echo Html::activeLabel($model,'date'); ?>
<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
    'name'=>'Event[date]',
    // additional javascript options for the date picker plugin
    'options'=>array(
        'dateFormat'=>'yy-mm-dd',
    ),
));
?>
</div>
<div class="simple">
<?php echo Html::activeLabel($model,'content'); ?>
<?php echo $JFV->activeTextArea($model,'content'); ?>
</div>
<?php if(Yii::app()->user->hasAuth(Group::ADMIN)): ?>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'visible'); ?>
<?php echo Html::activeDropDownList($model,'visible',
array(
'private'=>Yii::t('yii','Private'),
'public'=>Yii::t('yii','Public')
)); ?>
</div>
<?php endif; ?>
<div class="action">
<?php echo Html::submitButton(Yii::t('yii','Save'),array('class'=>'submit')); ?>
</div>

<?php echo $JFV->endForm(); ?>
</div><!-- yiiForm -->
<script type="text/javascript">
$("form").bind("submit", function() { return false; });

$('.submit').bind('click', function () {
  jQuery.ajax({
'type':'POST',
'url': jQuery(this).parents("form").attr("action"),
'cache':false,
'data':jQuery(this).parents("form").serialize(),
'success':function(html){
jQuery("#content").html(html)}
});
  
  return false;
});

</script>
